home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games: Greatest Hits 1996 / Amiga Games: Greatest Hits 1996.iso / spiele / publicdomain / amigamud-tt / mystuff / money.m < prev    next >
Text File  |  1996-07-08  |  3KB  |  129 lines

  1. /*
  2.  * money.m - MUD code for dropping piles of money on the floor
  3.  */
  4.  
  5. use t_util
  6. use t_base
  7. use tp_verbs
  8.  
  9. private proc utility MoneyGet(thing money)status:
  10.   thing me,here;
  11.  
  12.   me:=Me();
  13.   here:=Here();
  14.  
  15.   me@p_pMoney := me@p_pMoney + money@p_pMoney;
  16.   Print("You pick up " + IntToString(money@p_pMoney) + " blutos.\n");
  17.   if not me@p_pHidden and CanSee(here, me) then
  18.     OPrint(Capitalize(me@p_pName) + " picks up the pile of money.\n");
  19.   else
  20.     OPrint("The pile of money rises and vanishes from view!.\n");
  21.   fi;
  22.  
  23.   DelElement(here@p_rContents, money);
  24.   money -- p_oWhere;
  25.   money -- p_pMoney;
  26.   ClearThing(money);
  27.  
  28.   succeed
  29. corp
  30.  
  31.  
  32. private proc utility MoneyLook()string:
  33.   thing it;
  34.  
  35.   it:=It();
  36.   "The pile of " + IntToString(it@p_pMoney) + " coins glitters enticeingly."
  37. corp
  38.  
  39.  
  40. private o_fakeMoney CreateThing(nil).
  41. o_fakeMoney@p_oGetChecker := MoneyGet.
  42. o_fakeMoney@p_oName := "money,coins;pile of".
  43. /*o_fakeMoney@p_oDesc := "The pile of coins glitters enticeingly.".*/
  44. o_fakeMoney@p_oDescAction:=MoneyLook.
  45.  
  46.  
  47. private proc utility MoneyDrop()status:
  48.   string a,b;
  49.   int amount;
  50.   thing me, here, bag;
  51.  
  52.   a:=GetWord();
  53.   b:=GetWord();
  54.   if b=="blutos" or b=="bluto" or b=="coins" or b=="coin" then
  55.     amount:=StringToInt(a);
  56.     if amount>0 then
  57.       me:=Me();
  58.       here:=Here();
  59.       if me@p_pMoney<amount then
  60.     Print("You only have " + IntToString(me@p_pMoney) + " bluto(s)\n");
  61.     fail
  62.       else
  63.     me@p_pMoney :=me@p_pMoney-amount;
  64.     bag:=CreateThing(o_fakeMoney);
  65.     bag@p_pMoney:=amount;
  66.     bag@p_oWhere:=here;
  67.     AddTail(here@p_rContents,bag);
  68.     Print("You drop " + IntToString(amount) + " blutos into a tidy pile on the floor.\n");
  69.     if not me@p_pHidden and CanSee(here, me) then
  70.       OPrint(Capitalize(me@p_pName) + " drops some money on the floor.\n");
  71.     else
  72.       OPrint("A handful of money appear out of thin air and drops on the floor.\n");
  73.     fi;
  74.     succeed
  75.       fi
  76.     else
  77.       Print("You must drop at least one bluto\n");
  78.       fail
  79.     fi
  80.   else
  81.     continue
  82.   fi
  83. corp
  84.  
  85. /* replace the v_drop procedure in verbs.m with mine */
  86.  
  87. replace v_drop(string what)bool:
  88.   thing me, object;
  89.   string whatName;
  90.   status st;
  91.  
  92.   me := Me();
  93.   if what = "" then
  94.     Print("You must specify what you want to drop.\n");
  95.     false
  96.   elif what == "all" then
  97.     st := DoAll(me@p_pCarrying, dropAllStub);
  98.     if st = fail then
  99.       Print("You are not carrying anything obvious to drop.\n");
  100.       false
  101.     else
  102.       st = continue
  103.     fi
  104.   else
  105.     whatName := FormatName(what);
  106.     st := FindName(me@p_pCarrying, p_oName, what);
  107.     if st = succeed then
  108.       object := FindResult();
  109.       DoDrop(Here(), me, object) ~= fail
  110.     elif st = continue then
  111.       Print(whatName + " is ambiguous.\n");
  112.       false
  113.     else
  114.       st := MoneyDrop();
  115.       if st=succeed then
  116.     true
  117.       elif st=continue then
  118.     Print(AAn("You are not carrying", whatName) + ".\n");
  119.     false
  120.       else
  121.     false
  122.       fi
  123.     fi
  124.   fi
  125. corp;
  126.  
  127. unuse tp_verbs
  128.  
  129.